
************************************************************************************
************************************************************************************
************************************************************************************
*** APPENDIX
************************************************************************************
************************************************************************************
************************************************************************************



/* In order to successfully replicate the results, you need to install the 
following packages: 

st0085_2.pkg        from:  http://www.stata-journal.com/software/sj14-2/

reghdfe             from http://fmwww.bc.edu/RePEc/bocode/r

rangejoin.pkg       from:  http://fmwww.bc.edu/RePEc/bocode/r/ 

rangestat.pkg       from:  http://fmwww.bc.edu/RePEc/bocode/r/

outreg2.pkg         from:  http://fmwww.bc.edu/RePEc/bocode/o/

In addition, ensure you have ftools (required by reghdfe), which can be installed with

ssc install ftools

And 

ssc install sutex

*/

/* The code assumes you have set the working directory to the folder that 
contains the datasets. All outputs are saved to that same folder. 
*/


************************************************************************************
*** Section A.1
************************************************************************************

use CDS_DMITD_replication.dta, clear


drop _merge 

merge m:1 iso_code using "merged_healthcare_dataset.dta"

xtset countryname_code date2
 
gen deltawindexinrow=windexinrow-l.windexinrow


* Figure A.1
 xtline stringencyindex if MV>6, tlabel(#3) scheme(538) xtitle("")

* Figure A.2
 xtline stringencyindex if MV>6, tlabel(#3) scheme(538) xtitle("") addplot(scatter stringencyindex date2 if deltawindexinrow>=0 & MV>6, mcolor(red%10) || scatter stringencyindex date2 if deltawindexinrow<0 & MV>6, mcolor(green%10))  legend(label(1 "Stringency Index") label(2 "Stringency Index when {&Delta}{subscript:it}{&ge}0") label(3 "Stringency Index when {&Delta}{subscript:it}<0") pos(6) row(1) size(small))

************************************************************************************
*** Section A.2
************************************************************************************

sutex  stringencyindex  windexinrow new_cases_per_million2 new_deaths_per_million2 wtraderow wnationrow windexideorow  gee  hospital_beds_p1k SPI_2019  if MV>6, lab nobs key(descstat) replace

************************************************************************************
******** TABLE B.1 A spatial lag based on cultural proximity
************************************************************************************


xtset countryname_code date2

* two measures of cultural proximity: 1) windexculrow based on Kandogan, Yener. 2012. "An Improvement to Kogut and Singh Measure of Cultural Distance Consider-ing the Relationship Among Different Dimensions of Culture." Research in International Business and Finance 26(2): 196-203; 2) windexculrow2 based on Kogut, Bruce, and Harbir Singh. 1988. "The Effect of National Culture on the Choice of Entry Mode." Journal of International Business Studies 19(3): 411-32
* in both cases we inverted this cultural variable so that higher values pertain to more cultural similarity in our data.
* note: no cultural data for 6 countries ("Iceland" | countryname=="Latvia" | countryname=="Lithuania" | countryname=="Luxembourg" | countryname=="Slovakia" | countryname=="Slovenia")

sum windexculrow
* altissima correlazione!
corr windexinrow windexculrow windexculrow2

gen deltawindexculrow=windexculrow-l.windexculrow
gen deltawindexculrow2=windexculrow2-l.windexculrow2


************************************************************************************
******** TABLE B.1 A spatial lag based on cultural proximity outreg 
************************************************************************************

reghdfe stringencyindex l.stringencyindex c.l.windexculrow2 l.new_cases_per_million2 ///
l.new_deaths_per_million2 if MV>6  ,    abs(countryname_code month_code) vce(r) 

outreg2 using tableb1.tex ,   replace keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.c.windexculrow2)  alpha(0.001, 0.01, 0.05)   nocons word label dec(3)   tex addtext(DELTA, ALL, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex c.l.windexculrow2 l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexculrow2>=0  & MV>6  ,    abs(countryname_code month_code) vce(r) 

outreg2 using tableb1.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.c.windexculrow2)  alpha(0.001, 0.01, 0.05)   nocons word label dec(3)   tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex c.l.windexculrow2 l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexculrow2<0  & MV>6 ,    abs(countryname_code month_code) vce(r)  

outreg2 using tableb1.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.c.windexculrow2)  alpha(0.001, 0.01, 0.05)   nocons word label dec(3)   tex addtext(DELTA, NEGATIVE, Controls, YES, Country FE, YES, Month FE, YES)  

************************************************************************************
******** Table B.2: Main results with a spatial-X lag
************************************************************************************

corr windexinrow spatialdeathrowinv

gen lspatialdeathrowinv= l.spatialdeathrowinv


label variable lspatialdeathrowinv "W New Deaths (lag)"


gen lstringencyindex = l.stringencyindex
gen lwindexinrow = l.windexinrow 
gen lwtraderow = l.wtraderow
gen lwnationrow = l.wnationrow 
gen lwindexideorow =l.windexideorow
gen lnew_cases_per_million2 = l.new_cases_per_million2
gen lnew_deaths_per_million2 = l.new_deaths_per_million2

label variable lstringencyindex "Stringency (lag)"
label variable lwindexinrow "Geography (lag)"
label variable lwtraderow "Trade (lag)"
label variable lwnationrow "Nationalism (lag)"
label variable lwindexideorow "Left-Right (lag)"
label variable lnew_cases_per_million2 "New Cases (lag)"
label variable lnew_deaths_per_million2 "New Deaths (lag)"


************************************************************************************
******** Table B.2: Main results with a spatial-X lag outreg
************************************************************************************

reghdfe stringencyindex  lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2 ///
lspatialdeathrowinv if  MV>6 ,     abs(countryname_code month_code) vce(r)

outreg2 est1 using tableb2.tex, replace keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2 lspatialdeathrowinv) alpha(0.01, 0.05) nocons   word label dec(3)     tex addtext(Delta, All, Country FE, YES, Month FE, YES)  
 
reghdfe stringencyindex  lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2 ///
lspatialdeathrowinv if l.deltawindexinrow>=0  & MV>6 ,     abs(countryname_code month_code) vce(r)

 outreg2 est1 using tableb2.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2 lspatialdeathrowinv) alpha(0.01, 0.05) nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)  
 
reghdfe stringencyindex  lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2 ///
lspatialdeathrowinv if l.deltawindexinrow<0  & MV>6 ,     abs(countryname_code month_code) vce(r)

 outreg2 est1 using tableb2.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2 lspatialdeathrowinv) alpha(0.01, 0.05) nocons   word label dec(3)     tex addtext(Delta, <0, Country FE, YES, Month FE, YES)  
 

************************************************************************************
******** Table B.3: Different temporal lags outreg
************************************************************************************

reghdfe stringencyindex l3.stringencyindex l3.windexinrow l3.new_cases_per_million2 ///
l3.new_deaths_per_million2 if  MV>6 & l3.deltawindexinrow>=0  ,    abs(countryname_code month_code) vce(r) 

outreg2 using tableb3.tex,replace keep( L3.stringencyindex L3.new_cases_per_million2 L3.new_deaths_per_million2  L3.windexinrow L7.stringencyindex L7.new_cases_per_million2 L7.new_deaths_per_million2  L7.windexinrow L15.stringencyindex L15.new_cases_per_million2 L15.new_deaths_per_million2  L15.windexinrow) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)      tex addtext(DELTA, POSITIVE L3, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l3.stringencyindex l3.windexinrow l3.new_cases_per_million2 ///
l3.new_deaths_per_million2 if MV>6 & l3.deltawindexinrow<0  ,    abs(countryname_code month_code) vce(r)  

outreg2 using tableb3.tex, keep( L3.stringencyindex L3.new_cases_per_million2 L3.new_deaths_per_million2  L3.windexinrow L7.stringencyindex L7.new_cases_per_million2 L7.new_deaths_per_million2  L7.windexinrow L15.stringencyindex L15.new_cases_per_million2 L15.new_deaths_per_million2  L15.windexinrow)  alpha(0.001, 0.01, 0.05)  nocons word label dec(3)      tex addtext(DELTA, NEGATIVE L3, Controls, YES, Country FE, YES, Month FE, YES) 
 
reghdfe stringencyindex L7.stringencyindex L7.windexinrow L7.new_cases_per_million2 ///
L7.new_deaths_per_million2 if MV>6 & L7.deltawindexinrow>=0  ,    abs(countryname_code month_code) vce(r) 

outreg2 using tableb3.tex, keep( L3.stringencyindex L3.new_cases_per_million2 L3.new_deaths_per_million2  L3.windexinrow L7.stringencyindex L7.new_cases_per_million2 L7.new_deaths_per_million2  L7.windexinrow L15.stringencyindex L15.new_cases_per_million2 L15.new_deaths_per_million2  L15.windexinrow)  alpha(0.001, 0.01, 0.05)   nocons word label dec(3)      tex addtext(DELTA, POSITIVE L7, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex L7.stringencyindex L7.windexinrow L7.new_cases_per_million2 ///
L7.new_deaths_per_million2 if MV>6 & L7.deltawindexinrow<0  ,    abs(countryname_code month_code) vce(r)  

outreg2 using tableb3.tex, keep( L3.stringencyindex L3.new_cases_per_million2 L3.new_deaths_per_million2  L3.windexinrow L7.stringencyindex L7.new_cases_per_million2 L7.new_deaths_per_million2  L7.windexinrow L15.stringencyindex L15.new_cases_per_million2 L15.new_deaths_per_million2  L15.windexinrow)  alpha(0.001, 0.01, 0.05)   nocons word label dec(3)      tex addtext(DELTA, NEGATIVE L7, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex L15.stringencyindex L15.windexinrow L15.new_cases_per_million2 ///
L15.new_deaths_per_million2 if MV>6 & L15.deltawindexinrow>=0  ,    abs(countryname_code month_code) vce(r) 

outreg2 using tableb3.tex, keep( L3.stringencyindex L3.new_cases_per_million2 L3.new_deaths_per_million2  L3.windexinrow L7.stringencyindex L7.new_cases_per_million2 L7.new_deaths_per_million2  L7.windexinrow L15.stringencyindex L15.new_cases_per_million2 L15.new_deaths_per_million2  L15.windexinrow)  alpha(0.001, 0.01, 0.05)  nocons word label dec(3)      tex addtext(DELTA, POSITIVE L7, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex L15.stringencyindex L15.windexinrow L15.new_cases_per_million2 ///
L15.new_deaths_per_million2 if MV>6 & L15.deltawindexinrow<0  ,    abs(countryname_code month_code) vce(r)  

outreg2 using tableb3.tex, keep( L3.stringencyindex L3.new_cases_per_million2 L3.new_deaths_per_million2  L3.windexinrow L7.stringencyindex L7.new_cases_per_million2 L7.new_deaths_per_million2  L7.windexinrow L15.stringencyindex L15.new_cases_per_million2 L15.new_deaths_per_million2  L15.windexinrow)  alpha(0.001, 0.01, 0.05)  nocons word label dec(3)      tex addtext(DELTA, NEGATIVE L7, Controls, YES, Country FE, YES, Month FE, YES)  

************************************************************************************
******** Table B.4: Weekly data
************************************************************************************

* see below 

************************************************************************************
******** Table B.5: The impact of upcoming elections 
************************************************************************************

eststo clear 
reghdfe stringencyindex lstringencyindex c.lwindexinrow##i.election_in_60_days lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow>=0  & MV>6,    abs(countryname_code month_code) vce(r)  
eststo
reghdfe stringencyindex lstringencyindex c.lwindexinrow##i.election_in_60_days lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow<0  & MV>6,    abs(countryname_code month_code) vce(r)  
eststo
reghdfe stringencyindex lstringencyindex c.lwindexinrow##i.election_in_30_days lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow>=0  & MV>6,    abs(countryname_code month_code) vce(r)  
eststo
reghdfe stringencyindex lstringencyindex c.lwindexinrow##i.election_in_30_days lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow<0  & MV>6,    abs(countryname_code month_code) vce(r)  
eststo
reghdfe stringencyindex lstringencyindex c.lwindexinrow##i.election_in_10_days lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow>=0  & MV>6,    abs(countryname_code month_code) vce(r)  
eststo
reghdfe stringencyindex lstringencyindex c.lwindexinrow##i.election_in_10_days lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow<0  & MV>6,    abs(countryname_code month_code) vce(r)  
eststo
esttab est1 est2 est3 est4 est5 est6, label  se aic bic r2 ar2  star(* 0.05 ** 0.01 *** 0.001) 

************************************************************************************
******** Table B.5: The impact of upcoming elections outreg 
************************************************************************************

gen inter1 = lwindexinrow*election_in_10_days
gen inter2 = lwindexinrow*election_in_30_days
gen inter3 = lwindexinrow*election_in_60_days

label variable inter1 "W Geography (lag) * Elections (10 days)"
label variable inter2 "W Geograph (lag) * Elections (30 days)"
label variable inter3 "W Geograph (lag) * Elections (60 days)"

 reghdfe stringencyindex  lstringencyindex lwindexinrow  election_in_60_days inter3 lnew_deaths_per_million2     lnew_cases_per_million2 ///
 if l.deltawindexinrow>=0  & MV>6 ,     abs(countryname_code month_code) vce(r)

 outreg2 est1 using tableB5.tex, replace keep(lstringencyindex lwindexinrow  election_in_60_days inter3 lnew_deaths_per_million2     lnew_cases_per_million2 )  alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)  
 
reghdfe stringencyindex  lstringencyindex lwindexinrow  election_in_60_days inter3 lnew_deaths_per_million2     lnew_cases_per_million2 ///
 if l.deltawindexinrow<0  & MV>6 ,     abs(countryname_code month_code) vce(r)

 outreg2 est1 using tableB5.tex,  keep(lstringencyindex lwindexinrow  election_in_60_days inter3 lnew_deaths_per_million2     lnew_cases_per_million2 )  alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Delta, <0, Country FE, YES, Month FE, YES)  
 
reghdfe stringencyindex  lstringencyindex lwindexinrow  election_in_30_days inter2 lnew_deaths_per_million2     lnew_cases_per_million2 ///
 if l.deltawindexinrow>=0  & MV>6 ,     abs(countryname_code month_code) vce(r)

 outreg2 est1 using tableB5.tex,  keep(lstringencyindex lwindexinrow  election_in_30_days inter2 lnew_deaths_per_million2     lnew_cases_per_million2 )  alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)  
 
reghdfe stringencyindex  lstringencyindex lwindexinrow  election_in_30_days inter2 lnew_deaths_per_million2     lnew_cases_per_million2 ///
 if l.deltawindexinrow<0  & MV>6 ,     abs(countryname_code month_code) vce(r)

 outreg2 est1 using tableB5.tex,  keep(lstringencyindex lwindexinrow  election_in_30_days inter2 lnew_deaths_per_million2     lnew_cases_per_million2 )  alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Delta, <0, Country FE, YES, Month FE, YES)  

 reghdfe stringencyindex  lstringencyindex lwindexinrow  election_in_10_days inter1 lnew_deaths_per_million2     lnew_cases_per_million2 ///
 if l.deltawindexinrow>=0  & MV>6 ,     abs(countryname_code month_code) vce(r)

 outreg2 est1 using tableB5.tex,  keep(lstringencyindex lwindexinrow  election_in_10_days inter1 lnew_deaths_per_million2     lnew_cases_per_million2 )  alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)  
 
reghdfe stringencyindex  lstringencyindex lwindexinrow  election_in_10_days inter1 lnew_deaths_per_million2     lnew_cases_per_million2 ///
 if l.deltawindexinrow<0  & MV>6 ,     abs(countryname_code month_code) vce(r)

 outreg2 est1 using tableB5.tex,  keep(lstringencyindex lwindexinrow  election_in_10_days inter1 lnew_deaths_per_million2     lnew_cases_per_million2 )  alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Delta, <0, Country FE, YES, Month FE, YES)  
 
************************************************************************************
******** TABLE B.6 new
************************************************************************************

** rescale for readability

replace  pyll_total_years_p100k=pyll_total_years_p100k/1000 


reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.c.windexinrow##c.pyll_total_years_p100k l.c.windexinrow##c.gee,    abs(countryname_code month_code) vce(r)  


outreg2 using table6bAppendix.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 c.l.windexinrow##c.gee c.l.new_deaths_per_million2##c.gee l.c.windexinrow##c.pyll_total_years_p100k ) alpha(0.01, 0.05, .1)  nocons word label dec(3)   tex addtext(DELTA, ALL,  Country FE, YES, Month FE, YES)  replace


reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.c.windexinrow##c.pyll_total_years_p100k  l.c.windexinrow##c.gee if l.deltawindexinrow>=0,    abs(countryname_code month_code) vce(r)

outreg2 using table6bAppendix.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 c.l.windexinrow##c.gee c.l.new_deaths_per_million2##c.gee l.c.windexinrow##c.pyll_total_years_p100k ) alpha(0.01, 0.05, .1)  nocons word label dec(3)   tex addtext(DELTA, POS,  Country FE, YES, Month FE, YES) 



reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.c.windexinrow##c.pyll_total_years_p100k  l.c.windexinrow##c.gee if l.deltawindexinrow<0,    abs(countryname_code month_code) vce(r) 

outreg2 using table6bAppendix.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 c.l.windexinrow##c.gee c.l.new_deaths_per_million2##c.gee l.c.windexinrow##c.pyll_total_years_p100k ) alpha(0.01, 0.05, .1)  nocons word label dec(3)   tex addtext(DELTA, NEG,  Country FE, YES, Month FE, YES) 



**  with hospital_beds_p1k 



reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.c.windexinrow##c.hospital_beds_p1k l.c.windexinrow##c.gee,    abs(countryname_code month_code) vce(r)  


outreg2 using table6bAppendix.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 c.l.windexinrow##c.gee c.l.new_deaths_per_million2##c.gee l.c.windexinrow##c.hospital_beds_p1k) alpha(0.01, 0.05, .1)  nocons word label dec(3)   tex addtext(DELTA, ALL,  Country FE, YES, Month FE, YES) 




reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.c.windexinrow##c.hospital_beds_p1k  l.c.windexinrow##c.gee if l.deltawindexinrow>=0,    abs(countryname_code month_code) vce(r)

outreg2 using table6bAppendix.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 c.l.windexinrow##c.gee c.l.new_deaths_per_million2##c.gee l.c.windexinrow##c.hospital_beds_p1k) alpha(0.01, 0.05, .1)  nocons word label dec(3)   tex addtext(DELTA, POS,  Country FE, YES, Month FE, YES) 



reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.c.windexinrow##c.hospital_beds_p1k l.c.windexinrow##c.gee if l.deltawindexinrow<0,    abs(countryname_code month_code) vce(r)  
 
 
 
outreg2 using table6bAppendix.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 c.l.windexinrow##c.gee c.l.new_deaths_per_million2##c.gee l.c.windexinrow##c.hospital_beds_p1k) alpha(0.01, 0.05, .1)  nocons word label dec(3)   tex addtext(DELTA, NEG,  Country FE, YES, Month FE, YES) 






************************************************************************************
******** Table B.7: Heterogeneity driven by statistical capacity and by cumulative epidemic impact
************************************************************************************


** SPI is in the healthcare dataset

egen mean_SPI=mean(SPI_2019)
egen sd_SPI=sd(SPI_2019)
replace SPI_2019=(SPI_2019-mean_SPI)/sd_SPI


****** generate running tally of deaths for each country every day 

replace  total_deaths_per_m=0 if  total_deaths_per_m==.
gen days_passed = date2-21920
gen howbaditwas=total_deaths_per_million/days_passed


xtset countryname_code date2

************************************************************************************
******** Table B.7: Heterogeneity driven by statistical capacity and by cumulative epidemic impact outreg
************************************************************************************

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2##c.SPI_2019 l.c.windexinrow##c.SPI_2019 if MV>6,    abs(countryname_code month_code) vce(r)  
 
outreg2 using tableIrrelevant.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 c.l.c.new_deaths_per_million2##c.SPI_2019 l.c.windexinrow##c.SPI_2019)  alpha(0.001, 0.01, 0.05)   ///
    symbol(***, **, *)   nocons word label dec(3)   tex addtext(DELTA, NEG,  Country FE, YES, Month FE, YES)  replace

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2##c.SPI_2019 l.c.windexinrow##c.SPI_2019 if l.deltawindexinrow>=0 & MV>6,    abs(countryname_code month_code) vce(r)

outreg2 using tableIrrelevant.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 c.l.c.new_deaths_per_million2##c.SPI_2019 l.c.windexinrow##c.SPI_2019)  alpha(0.001, 0.01, 0.05)  ///
    symbol(***, **, *)   nocons word label dec(3)   tex addtext(DELTA, NEG,  Country FE, YES, Month FE, YES)  append

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2##c.SPI_2019 l.c.windexinrow##c.SPI_2019 if l.deltawindexinrow<0 & MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 using tableIrrelevant.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 c.l.c.new_deaths_per_million2##c.SPI_2019 l.c.windexinrow##c.SPI_2019)  alpha(0.001, 0.01, 0.05)  ///
    symbol(***, **, *)   nocons word label dec(3)   tex addtext(DELTA, NEG,  Country FE, YES, Month FE, YES)  append
	
reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2 l.c.windexinrow##c.howbaditwas if MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 using  tableIrrelevant.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  l.c.windexinrow  l.c.windexinrow##c.howbaditwas )  alpha(0.001, 0.01, 0.05)   nocons word label dec(3)   tex addtext(DELTA,ALL,  CountryFE, Y, Month FE, YES) append

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2 l.c.windexinrow##c.howbaditwas if l.deltawindexinrow>=0 & MV>6,    abs(countryname_code month_code) vce(r)

outreg2 using tableIrrelevant.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  l.c.windexinrow  l.c.windexinrow##c.howbaditwas)  alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, ALL,  CountryFE, Y, Month FE, YES) append

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2 l.c.windexinrow##c.howbaditwas if l.deltawindexinrow<0 & MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 using  tableIrrelevant.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  l.c.windexinrow  l.c.windexinrow##c.howbaditwas)  alpha(0.001, 0.01, 0.05)   nocons word label dec(3)   tex addtext(DELTA, NEG,  CountryFE, Y, Month FE, YES) append

************************************************************************************
******** TABLE B.8 Alternative measuers of geography
************************************************************************************

gen  lwindexCONTrow =  l.windexCONTrow

************************************************************************************
******** TABLE B.8 outreg Alternative measuers of geography
************************************************************************************

reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2 if MV>6,    abs(countryname_code month_code) vce(r)  

estat ic

outreg2 est1 using tableb8.tex, replace keep(lstringencyindex lwindexinrow  lwindexCONTrow  lnew_cases_per_million2 lnew_deaths_per_million2) alpha(0.001, 0.01, 0.05) nocons   word label dec(3)   tex addtext(Country FE, YES, Month FE, YES)  

reghdfe stringencyindex lstringencyindex lwindexCONTrow lnew_cases_per_million2 ///
lnew_deaths_per_million2 if MV>6,    abs(countryname_code month_code) vce(r)  

estat ic

outreg2 est1 using tableb8.tex,  keep(lstringencyindex lwindexinrow  lwindexCONTrow  lnew_cases_per_million2 lnew_deaths_per_million2) alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Country FE, YES, Month FE, YES)  


************************************************************************************
******** TABLE B.9 Asymmetric policy diffusion based on trade relations and the nationalist dimension outreg
************************************************************************************


gen deltawtraderow=wtraderow-l.wtraderow 

gen deltawnationrow = wnationrow-l.wnationrow 


reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.wtraderow if MV>6 & l.deltawtraderow>=0  ,    abs(countryname_code month_code) vce(r)  

outreg2 using tableB9.tex, keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 L.wtraderow)  alpha(0.001, 0.01, 0.05) replace nocons word label dec(3)     tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.wtraderow if MV>6 & l.deltawtraderow<0  ,    abs(countryname_code month_code) vce(r)  

outreg2 using tableB9.tex, keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 L.wtraderow)  alpha(0.001, 0.01, 0.05)  nocons word label dec(3)     tex addtext(DELTA, NEGATIVE, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex l.wnationrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if MV>6 & l.deltawnationrow>=0 ,    abs(countryname_code month_code) vce(r)  

outreg2 using tableB9.tex, keep(L.wnationrow L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2)  alpha(0.001, 0.01, 0.05)  nocons word label dec(3)     tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex l.wnationrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if MV>6 & l.deltawnationrow<0 ,    abs(countryname_code month_code) vce(r)  

outreg2 using tableB9.tex, keep(L.wnationrow L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2)  alpha(0.001, 0.01, 0.05)  nocons word label dec(3)     tex addtext(DELTA, NEGATIVE, Controls, YES, Country FE, YES, Month FE, YES)  

************************************************************************************
******** TABLE B.10 Excluding European countries
************************************************************************************

* see below

************************************************************************************
******** TABLE B.11 Excluding Italy, Spain and Greece
************************************************************************************

gen exclude1 = 1 if countryname=="Italy" | countryname=="Spain" | countryname=="Greece" 
gen exclude2 = 1 if month_code==6 | month_code==7 | month_code==8 | month_code==18 | month_code==19 | month_code==20

tab countryname if exclude1==1
tab month_code if exclude2==1

gen exclude =1 if exclude1==1 & exclude2==1
tab countryname if exclude==1
tab month_code if exclude==1

eststo clear
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if MV>6 & exclude!=1,    abs(countryname_code month_code) vce(r)  
eststo
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow>=0  & MV>6 &  exclude!=1,    abs(countryname_code month_code) vce(r) 
eststo
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow<0  & MV>6 &  exclude!=1,    abs(countryname_code month_code) vce(r)  
eststo
esttab est1 est2 est3, label  se aic bic r2 ar2  star(* 0.05 ** 0.01 *** 0.001) 

************************************************************************************
******** TABLE B.11 Excluding Italy, Spain and Greece outreg
************************************************************************************

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if MV>6 & exclude!=1,    abs(countryname_code month_code) vce(r)  

outreg2 using table5a.tex, replace  keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, ALL, Controls, YES, Country FE, YES, Month FE, YES)  
 
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow>=0  & MV>6 &  exclude!=1,    abs(countryname_code month_code) vce(r) 

outreg2 using table5a.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05) nocons word label dec(3)   tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)   

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow<0  & MV>6 &  exclude!=1,    abs(countryname_code month_code) vce(r)  

outreg2 using table5a.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, NEGATIVE, Controls, YES, Country FE, YES, Month FE, YES)  


************************************************************************************
******** TABLE B.12 Excluding Italy, Spain, Greece, France, Portugal, Turkey, and Israel
************************************************************************************

gen exclude1B = 1 if countryname=="Italy" | countryname=="Spain" | countryname=="Greece" | countryname=="Turkey"  | countryname=="Israel"  | countryname=="France" |countryname=="Portugal"

gen excludeB =1 if exclude1B==1 & exclude2==1
tab countryname if excludeB==1
tab month_code if excludeB==1

************************************************************************************
******** TABLE B.12 Excluding Italy, Spain, Greece, France, Portugal, Turkey, and Israel outreg 
************************************************************************************

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if MV>6 & excludeB!=1,    abs(countryname_code month_code) vce(r)  

outreg2 using table5b.tex, replace  keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, ALL, Controls, YES, Country FE, YES, Month FE, YES)  
  
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow>=0  & MV>6 &  excludeB!=1,    abs(countryname_code month_code) vce(r) 

outreg2 using table5b.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  
  
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow<0  & MV>6 &  excludeB!=1,    abs(countryname_code month_code) vce(r)  

outreg2 using table5b.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05) nocons word label dec(3)   tex addtext(DELTA, NEGATIVE, Controls, YES, Country FE, YES, Month FE, YES)  

************************************************************************************
******** TABLE B.13 Separate pandemic waves
************************************************************************************

tab month2

tab month2 if month_code<9
gen first_wave = 1 if month_code<9
recode first_wave (.=0)

tab month2 if month_code>8 & month_code<21
gen second_wave = 1 if month_code>8 & month_code<21
recode second_wave (.=0)

tab month2 if first_wave==0 & second_wave==0
gen third_wave=1 if first_wave==0 & second_wave==0
recode third_wave (.=0)

tab first_wave second_wave
tab first_wave third_wave

tab  first_wave
tab second_wave
tab third_wave


************************************************************************************
******** TABLE B.13 Separate pandemic waves outreg
************************************************************************************

* first wave

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.windexinrow if MV>6 & l.deltawindexinrow>=0  & first_wave==1,    abs(countryname_code month_code) vce(r) 

outreg2 using tableb13.tex, keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05) nocons word label dec(3)   replace   tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if MV>6 &  l.deltawindexinrow<0  & first_wave==1,    abs(countryname_code month_code) vce(r)  

outreg2 using tableb13.tex, keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)     tex addtext(DELTA, NEGATIVE, Controls, YES, Country FE, YES, Month FE, YES)  

* second wave

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if MV>6 &  l.deltawindexinrow>=0  & second_wave==1,    abs(countryname_code month_code) vce(r) 

outreg2 using tableb13.tex, keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05) nocons word label dec(3)   tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if MV>6 &  l.deltawindexinrow<0  & second_wave==1,    abs(countryname_code month_code) vce(r)  

outreg2 using tableb13.tex, keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)  tex addtext(DELTA, NEGATIVE, Controls, YES, Country FE, YES, Month FE, YES)  

* third wave

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if MV>6 &  l.deltawindexinrow>=0  & third_wave==1,    abs(countryname_code month_code) vce(r) 

outreg2 using tableb13.tex, keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if MV>6 & l.deltawindexinrow<0  & third_wave==1,    abs(countryname_code month_code) vce(r)  

outreg2 using tableb13.tex, keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05) nocons word label dec(3)   tex addtext(DELTA, NEGATIVE, Controls, YES, Country FE, YES, Month FE, YES)  

************************************************************************************
******** TABLE B.14 Replication Models with country-by-quarter fixed effects
************************************************************************************

gen month_code2=month_code
gen trimester=1 if month_code2<4
replace trimester=2 if month_code2>3 & month_code2<7
replace trimester=3 if month_code2>6 & month_code2<10
replace trimester=4 if month_code2>9 & month_code2<13
replace trimester=5 if month_code2>12 & month_code2<16
replace trimester=6 if month_code2>15 & month_code2<19
replace trimester=7  if month_code2>18 & month_code2<22
replace trimester=8 if month_code2>21 & month_code2<25
replace trimester=9  if month_code2>24 
tab trimester



************************************************************************************
******** TABLE B.14 Replication Models with country-by-quarter fixed effects outreg
************************************************************************************

reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2 i.countryname_code##i.trimester if MV>6,    abs( month_code) vce(r)  

 outreg2 est1 using tableb14.tex,  replace keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2    lnew_cases_per_million2) nocons   word label dec(3)     tex addtext(Delta, All, Country FE, YES, Month FE, YES)      alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *) 

reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2  i.countryname_code##i.trimester if l.deltawindexinrow>=0  & MV>6,    abs(month_code) vce(r)

 outreg2 est1 using tableb14.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2) nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)      alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *) 

reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2  i.countryname_code##i.trimester if l.deltawindexinrow<0  & MV>6,    abs(month_code) vce(r)  

 outreg2 est1 using tableb14.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2)  nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)       alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *) 
	
************************************************************************************
******** TABLE B.15 Replication Models with country-by-semester fixed effects
************************************************************************************

tab month_code2
gen semester1=1 if month_code2<7
recode semester1(.=0)
gen semester2=1 if month_code2>6 & month_code2<13
recode semester2(.=0)
gen semester3=1 if month_code2>12 & month_code2<19
recode semester3(.=0)
gen semester4=1 if month_code2>18 & month_code2<25
recode semester4(.=0)
* questo dura 3 mesi
gen semester5=1 if month_code2>24
recode semester5(.=0)
tab semester1
tab semester2
tab semester3
tab semester4
tab semester5

gen semester=1 if month_code2<7
replace semester=2 if month_code2>6 & month_code2<13
replace semester=3 if month_code2>12 & month_code2<19
replace semester=4 if month_code2>18 & month_code2<25

replace semester=5 if month_code2>24
tab semester

************************************************************************************
******** TABLE B.15 Replication Models with country-by-semester fixed effects
************************************************************************************

reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2 i.countryname_code##i.semester if MV>6,    abs( month_code) vce(r)  

 outreg2 est1 using tableb15.tex,  replace keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2    lnew_cases_per_million2) nocons   word label dec(3)     tex addtext(Delta, All, Country FE, YES, Month FE, YES)      alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *) 
 
reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2  i.countryname_code##i.semester if l.deltawindexinrow>=0  & MV>6,    abs(month_code) vce(r)

 outreg2 est1 using tableb15.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2) nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)      alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *) 

reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2  i.countryname_code##i.semester if l.deltawindexinrow<0  & MV>6,    abs(month_code) vce(r)  

 outreg2 est1 using tableb15.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2)  nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)       alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *) 

************************************************************************************
******** TABLE C.1 Spatial Lag with a "Pure" Learning Effect
************************************************************************************


* decrease5: learning considering top-5% (daily)
* decrease10: learning considering top-10% (daily)
* decrease20: learning considering top-20% (daily)

gen ldecrease5 = l.decrease5
gen ldecrease10 = l.decrease10
gen ldecrease20 = l.decrease20

label variable ldecrease5 "Top 5% (lag)"
label variable ldecrease10 "Top 10% (lag)"
label variable ldecrease20 "Top 20% (lag)"

************************************************************************************
******** TABLE C.1 outreg Spatial Lag with a "Pure" Learning Effect outreg
************************************************************************************

reghdfe stringencyindex lstringencyindex   ldecrease5 lnew_cases_per_million2 ///
lnew_deaths_per_million2 if MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 est1 using tableC1.tex,  replace keep(lstringencyindex lwindexinrow  ldecrease5 ldecrease10 ldecrease20 lnew_cases_per_million2 ///
lnew_deaths_per_million2 ) alpha(0.001, 0.01, 0.05) nocons   word label dec(3)     tex addtext(Country FE, YES, Month FE, YES)  

reghdfe stringencyindex lstringencyindex   ldecrease10 l.new_cases_per_million2 ///
lnew_deaths_per_million2 if MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 est1 using tableC1.tex,  keep(lstringencyindex  lwindexinrow  ldecrease5 ldecrease10 ldecrease20  lnew_cases_per_million2 ///
lnew_deaths_per_million2 ) alpha(0.001, 0.01, 0.05) nocons   word label dec(3)     tex addtext(Country FE, YES, Month FE, YES)  

reghdfe stringencyindex lstringencyindex   ldecrease20 lnew_cases_per_million2 ///
lnew_deaths_per_million2 if MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 est1 using tableC1.tex,  keep(lstringencyindex    ldecrease5 decrease10 ldecrease20  lnew_cases_per_million2 ///
lnew_deaths_per_million2 ) alpha(0.001, 0.01, 0.05) nocons   word label dec(3)     tex addtext(Country FE, YES, Month FE, YES)  

************************************************************************************
******** TABLE C.2 TLSL vs. SAR model of geographical proximity effects
************************************************************************************
 
spmatrix use Idistrow using "IdistSrowxt.stswm", replace

spmatrix dir
spmatrix summarize  Idistrow

xtset countryname_code date2

gen deltawindexinv = windexinv-l.windexinv

************************************************************************************
******** TABLE C.2 TLSL vs. SAR model of geographical proximity effects outreg
************************************************************************************
 
* Baseline
reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2 if MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 est1 using tableC2.tex,  replace keep(lstringencyindex lwindexinrow  lnew_cases_per_million2 ///
lnew_deaths_per_million2 ) alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Country FE, YES, Month FE, YES)  

* SAR model

spxtregress stringencyindex lstringencyindex lnew_cases_per_million2 lnew_deaths_per_million2 i.month_code if MV>6, force fe dvarlag(Idistrow) 

outreg2 est1 using tableC2.tex,  keep(lstringencyindex lwindexinrow  lnew_cases_per_million2 ///
lnew_deaths_per_million2 ) alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Country FE, YES, Month FE, YES)  

************************************************************************************
******** TABLE C.3 Not Row-Standardized outreg
************************************************************************************

reghdfe stringencyindex l.stringencyindex l.windexinv l.new_cases_per_million2 ///
l.new_deaths_per_million2 if  MV>6  ,    abs(countryname_code month_code) vce(r) 

outreg2 using tableC3.tex, replace keep(L.windexinv L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)     tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex l.windexinv l.new_cases_per_million2 ///
l.new_deaths_per_million2 if  MV>6 & l.deltawindexinv>=0  ,    abs(countryname_code month_code) vce(r) 

outreg2 using tableC3.tex, keep(L.windexinv L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)     tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex l.windexinv l.new_cases_per_million2 ///
l.new_deaths_per_million2 if  MV>6 & l.deltawindexinv<0  ,    abs(countryname_code month_code) vce(r)  

outreg2 using tableC3.tex, keep(L.windexinv L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)     tex addtext(DELTA, NEGATIVE, Controls, YES, Country FE, YES, Month FE, YES)  

************************************************************************************
******** TABLE C.4 Models interacting institutional quality and the spatial lag with a different operationalization for institutional quality
************************************************************************************

cap drop pc1

pca vae pve gee rqe rle cce , components(1)
predict pc1

drop inter*

gen inter1 = lwindexinrow*pc1
gen inter2 = lnew_deaths_per_million2*pc1

label variable inter1 "Geography (lag) * IQ"
label variable inter2 "New Deaths (lag) * IQ"

************************************************************************************
******** TABLE C.4 Models interacting institutional quality and the spatial lag with a different operationalization for institutional quality outreg
************************************************************************************

reghdfe stringencyindex  lstringencyindex lwindexinrow inter1  lnew_deaths_per_million2 inter2    lnew_cases_per_million2 ///
 if  MV>6 ,     abs(countryname_code month_code) vce(r)

 outreg2 est1 using tableC4.tex, replace keep(lstringencyindex lwindexinrow inter1  lnew_deaths_per_million2 inter2  lnew_cases_per_million2) alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Delta, All, Country FE, YES, Month FE, YES)  
 
reghdfe stringencyindex  lstringencyindex lwindexinrow inter1  lnew_deaths_per_million2 inter2    lnew_cases_per_million2 ///
 if l.deltawindexinrow>=0  & MV>6 ,     abs(countryname_code month_code) vce(r)

 outreg2 est1 using tableC4.tex, append keep(lstringencyindex lwindexinrow inter1  lnew_deaths_per_million2 inter2    lnew_cases_per_million2) alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)  
 
reghdfe stringencyindex  lstringencyindex lwindexinrow inter1  lnew_deaths_per_million2 inter2    lnew_cases_per_million2 ///
 if l.deltawindexinrow<0  & MV>6 ,     abs(countryname_code month_code) vce(r)

  outreg2 est1 using tableC4.tex, append  keep(lstringencyindex lwindexinrow inter1  lnew_deaths_per_million2 inter2  lnew_cases_per_million2) alpha(0.001, 0.01, 0.05)  nocons   word label dec(3)     tex addtext(Delta, <0, Country FE, YES, Month FE, YES)
 


************************************************************************************
******** TABLE C.5 Exploring different clustered standard errors specifications outreg
************************************************************************************	

reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2 if MV>6,    abs(countryname_code month_code) cluster(date2 )  

 outreg2 est1 using tableC5.tex,  replace keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2    lnew_cases_per_million2) nocons   word label dec(3)     tex addtext(Delta, All, Country FE, YES, Month FE, YES)       alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *)

 reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow>=0  & MV>6,    abs(countryname_code month_code) cluster(date2 )   

 outreg2 est1 using tableC5.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2) nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)     alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *)
	
reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow<0  & MV>6,    abs(countryname_code month_code) cluster(date2 )   
  
 outreg2 est1 using tableC5.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2)  nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)      alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *) 

reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2 if MV>6,    abs(countryname_code month_code) cluster( countryname_code)  

 outreg2 est1 using tableC5.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2    lnew_cases_per_million2) nocons   word label dec(3)     tex addtext(Delta, All, Country FE, YES, Month FE, YES)       alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *) 

 reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow>=0  & MV>6,    abs(countryname_code month_code) cluster( countryname_code)   

 outreg2 est1 using tableC5.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2) nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)      alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *)

reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow<0  & MV>6,    abs(countryname_code month_code) cluster( countryname_code)   
  
 outreg2 est1 using tableC5.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2)  nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)      alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *)	
	
reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2 if MV>6,    abs(countryname_code month_code) cluster(date2 countryname_code)  

 outreg2 est1 using tableC5.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2    lnew_cases_per_million2) nocons   word label dec(3)     tex addtext(Delta, All, Country FE, YES, Month FE, YES)       alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *)

 reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow>=0  & MV>6,    abs(countryname_code month_code) cluster(date2 countryname_code)   

 outreg2 est1 using tableC5.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2) nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)      alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *)
reghdfe stringencyindex lstringencyindex lwindexinrow lnew_cases_per_million2 ///
lnew_deaths_per_million2  if l.deltawindexinrow<0  & MV>6,    abs(countryname_code month_code) cluster(date2 countryname_code)   
  
 outreg2 est1 using tableC5.tex,  keep(lstringencyindex lwindexinrow   lnew_deaths_per_million2     lnew_cases_per_million2)  nocons   word label dec(3)     tex addtext(Delta, >=0, Country FE, YES, Month FE, YES)      alpha(0.001, 0.01, 0.05) ///
    symbol(***, **, *) 	
	

************************************************************************************
******** Table B.4: Weekly data
************************************************************************************

use CDS_DMITD_replication.dta, clear


xtset countryname_code  date2

gen deltawindexinrow=windexinrow-l.windexinrow

 sort  countryname date2
 gen p=MV/7
 
 gen p2=p if p==int(p)
 
 forvalues i = 1 2 to 6{
 replace p2=p2[_n+1] if p2==.
 }
 
replace p2=115 if p2==.

collapse (mean) stringencyindex  windexinrow new_cases_per_million2 ///
new_deaths_per_million2 deltawindexinrow (first) month_code countryname_code, by (countryname p2)

xtset countryname_code p2

eststo clear
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 ,    abs(countryname_code month_code) vce(r)  
eststo
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow>=0  ,    abs(countryname_code month_code) vce(r) 
eststo
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow<0  ,    abs(countryname_code month_code) vce(r)  
eststo
esttab est1 est2 est3 , label  se aic bic r2 ar2  star(+ 0.1 * 0.05 ** 0.01 *** 0.001)

************************************************************************************
******** Table B.4: Weekly data outreg
************************************************************************************

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 ,    abs(countryname_code month_code) vce(r)  

outreg2 using tableB4.tex, replace keep(L.windexinrow L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2) alpha(0.01, 0.05)  nocons word label dec(3)     tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow>=0  ,    abs(countryname_code month_code) vce(r) 

outreg2 using tableB4.tex,  keep(L.windexinrow L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2) alpha(0.01, 0.05)  nocons word label dec(3)     tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow<0  ,    abs(countryname_code month_code) vce(r)  

outreg2 using tableB4.tex,  keep(L.windexinrow L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2) alpha(0.01, 0.05)  nocons word label dec(3)     tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  


use "cabinet_metrics_dataset.dta", replace

* here the dataset: https://www.dropbox.com/scl/fi/l55ijmjjk52jtk5uszb2h/cabinet_metrics_dataset.dta?rlkey=0ydf1q2kyrwn7kvzngkjit7np&dl=0

replace coalition_seat_share = pm_seat_share if coalition_seat_share==.

foreach var in  pm_seat_share coalition_seat_share {
    su `var'
local mean =r(mean)
local sd=r(sd)
    gen `var'_z = (`var' - `mean') / `sd'
}

gen end_date=next_start-1
 
rangejoin date2 start_date end_date using CDS_DMITD_replication.dta, by(iso_code) 

xtset countryname_code date2

gen deltawindexinrow=windexinrow-l.windexinrow
************************************************************************************
******** Table C.6 Heterogeneity driven by strength of the executive in the legislature outreg
************************************************************************************

**** also with interaction with DEATHS 

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z if MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 using tableCabinets.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, ALL,  Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z if l.deltawindexinrow>=0 & MV>6,    abs(countryname_code month_code) vce(r)

outreg2 using tableCabinets.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, POS,  Country FE, YES, Month FE, YES) 

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z if l.deltawindexinrow<0 & MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 using tableCabinets.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, NEG,  Country FE, YES, Month FE, YES) 




************************************************************************************
******** TABLE B.10 Excluding European countries
************************************************************************************

use CDS_DMITD_replication , clear

xtset countryname_code date2


gen deltawindexinrow=windexinrow-l.windexinrow

label variable new_cases_per_million2 "% Cases per Million (smooth)"
label variable new_deaths_per_million2 "% Deaths per Million (smooth)"
label variable windexinrow "WIndexInvGeoRow"
label variable windexCONTrow "WIndexInvGeoRow Contiguity"
label variable windexinrow "Spatial Lag: Geography L"

gen europe=1 if countryname!="Australia" & countryname!="Canada"  & countryname!="Chile" & countryname!="Colombia" & countryname!="Costa Rica"  & countryname!="Japan" & countryname!="Mexico" & countryname!="New Zealand" & countryname!="South Korea" & countryname!="United States"

recode europe(.=0)

tab europe

eststo clear
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if  MV>6 & europe!=1,    abs(countryname_code month_code) vce(r) 
eststo
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow>=0  & MV>6 & europe!=1,    abs(countryname_code month_code) vce(r) 
eststo
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow<0  & MV>6 & europe!=1,    abs(countryname_code month_code) vce(r)  
eststo

esttab est1 est2 est3 , label  se aic bic r2 ar2  star(+ 0.1 * 0.05 ** 0.01 *** 0.001)

************************************************************************************
******** TABLE B.10 Excluding European countries
************************************************************************************

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if  MV>6 & europe!=1,    abs(countryname_code month_code) vce(r) 

outreg2 using tableB10.tex, replace  keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05)    nocons word label dec(3)   tex addtext(DELTA, ALL, Controls, YES, Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow>=0  & MV>6 & europe!=1,    abs(countryname_code month_code) vce(r) 

outreg2 using tableB10.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05)    nocons word label dec(3)   tex addtext(DELTA, POSITIVE, Controls, YES, Country FE, YES, Month FE, YES)  
 
reghdfe stringencyindex l.stringencyindex l.windexinrow l.new_cases_per_million2 ///
l.new_deaths_per_million2 if l.deltawindexinrow<0  & MV>6 & europe!=1,    abs(countryname_code month_code) vce(r)  

outreg2 using tableB10.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2  L.windexinrow) alpha(0.001, 0.01, 0.05)    nocons word label dec(3)   tex addtext(DELTA, NEGATIVE, Controls, YES, Country FE, YES, Month FE, YES)  

************************************************************************************
******** Table C.6 Heterogeneity driven by strength of the executive in the legislature
************************************************************************************

use "cabinet_metrics_dataset.dta", replace

replace coalition_seat_share = pm_seat_share if coalition_seat_share==.
foreach var in vote_margin pm_seat_share coalition_seat_share {
    su `var'
local mean =r(mean)
local sd=r(sd)
    gen `var'_z = (`var' - `mean') / `sd'
}

gen end_date=next_start-1
 
rangejoin date2 start_date end_date using "CDS_DMITD_replication.dta" , by(iso_code) 

xtset countryname_code date2

gen deltawindexinrow = windexinrow-l.windexinrow 

************************************************************************************
******** Table C.6 Heterogeneity driven by strength of the executive in the legislature outreg
************************************************************************************


******** BY STRENGTH OF CABINET

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.c.windexinrow##c.coalition_seat_share_z if MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 using tableCabinets.tex,   keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, ALL,  Country FE, YES, Month FE, YES)  replace

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.c.windexinrow##c.coalition_seat_share_z if l.deltawindexinrow>=0 & MV>6,    abs(countryname_code month_code) vce(r)

outreg2 using tableCabinets.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, P,  Country FE, YES, Month FE, YES) 

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.new_deaths_per_million2 l.c.windexinrow##c.coalition_seat_share_z if l.deltawindexinrow<0 & MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 using tableCabinets.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, N,  Country FE, YES, Month FE, YES)  

**** also with interaction with DEATHS 

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z if MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 using tableCabinets.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, ALL,  Country FE, YES, Month FE, YES)  

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z if l.deltawindexinrow>=0 & MV>6,    abs(countryname_code month_code) vce(r)

outreg2 using tableCabinets.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, POS,  Country FE, YES, Month FE, YES) 

reghdfe stringencyindex l.stringencyindex  l.new_cases_per_million2 ///
l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z if l.deltawindexinrow<0 & MV>6,    abs(countryname_code month_code) vce(r)  

outreg2 using tableCabinets.tex,    keep( L.stringencyindex L.new_cases_per_million2 L.new_deaths_per_million2 l.c.new_deaths_per_million2##c.coalition_seat_share_z l.c.windexinrow##c.coalition_seat_share_z) alpha(0.001, 0.01, 0.05)  nocons word label dec(3)   tex addtext(DELTA, NEG,  Country FE, YES, Month FE, YES) 

*************************
*************************
* Interaction executive strenght
*************************
*************************

use "cabinet_metrics_dataset.dta", replace

replace coalition_seat_share = pm_seat_share if coalition_seat_share==.
foreach var in  pm_seat_share coalition_seat_share {
    su `var'
local mean =r(mean)
local sd=r(sd)
    gen `var'_z = (`var' - `mean') / `sd'
}

gen end_date=next_start-1
 
rangejoin date2 start_date end_date using "CDS_DMITD_replication.dta" , by(iso_code) 

xtset countryname_code date2

gen deltawindexinrow=windexinrow-l.windexinrow



reghdfe stringencyindex  c.l.new_deaths_per_million2##c.coalition_seat_share_z l.stringencyindex  l.new_cases_per_million2 ///
 c.l.windexinrow##c.coalition_seat_share_z if l.deltawindexinrow<0  & MV>6,     abs(countryname_code month_code) vce(r)

matrix b=e(b)
matrix V=e(V)
matlist b
matlist V
scalar b1=b[1,1]
scalar b3=b[1,3]
scalar list b1 b3
scalar varb1=V[1,1]
scalar varb3=V[3,3]
scalar covb1b3=V[1,3]
scalar list b1 b3 varb1 varb3 covb1b3

sum coalition_seat_share_z if e(sample)
generate MVZ=((_n/1)-3)
sum MVZ
replace MVZ=. if MVZ>3
sum MVZ

gen conbx=b1+b3*MVZ if MVZ!=.
gen consx=sqrt(varb1+varb3*(MVZ^2)+2*covb1b3*MVZ) if MVZ!=.
gen ax=1.96*consx
gen upperx=conbx+ax
gen lowerx=conbx-ax

gen yline=0

graph twoway hist coalition_seat_share_z, width(0.1) percent color(gs14) yaxis(2) ///
|| line conbx MVZ, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1) ///
|| line upperx MVZ, clpattern(dash) clwidth(thin) clcolor(black) ///
|| line lowerx MVZ, clpattern(dash) clwidth(thin) clcolor(black) ///
|| line yline MVZ, clwidth(thin) clcolor(black) clpattern(solid) ///
|| , ///
xlabel(-2.5 (1) 3.5, nogrid labsize(2)) ///
ylabel(-0.04 (0.02) 0.14, axis(1) nogrid labsize(2)) ///
ylabel(, axis(2) nogrid labsize(2)) ///
yscale(noline alt) ///
yscale(noline alt axis(2)) ///
xscale(noline) ///
legend(off) ///
xtitle("Executive strenght" , size(2.5) ) ///
ytitle("Marginal Effect of Lagged Deaths" , axis(1) size(2.5)) ///
ytitle("Percentage of Observations" , axis(2) size(2.5)) ///
xsca(titlegap(2)) ///
ysca(titlegap(2)) ///
scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) note("Model: only with delta<0")  saving(a.gph, replace)

reghdfe stringencyindex c.l.windexinrow##c.coalition_seat_share_z l.stringencyindex  l.new_cases_per_million2 ///
 c.l.new_deaths_per_million2##c.coalition_seat_share_z if l.deltawindexinrow>=0  & MV>6,     abs(countryname_code month_code) vce(r)
 
matrix b=e(b)
matrix V=e(V)
matlist b
matlist V
scalar b1=b[1,1]
scalar b3=b[1,3]
scalar list b1 b3
scalar varb1=V[1,1]
scalar varb3=V[3,3]
scalar covb1b3=V[1,3]
scalar list b1 b3 varb1 varb3 covb1b3

drop conbx consx ax upperx lowerx 

gen conbx=b1+b3*MVZ if MVZ!=.
gen consx=sqrt(varb1+varb3*(MVZ^2)+2*covb1b3*MVZ) if MVZ!=.
gen ax=1.96*consx
gen upperx=conbx+ax
gen lowerx=conbx-ax

graph twoway hist coalition_seat_share_z, width(0.1) percent color(gs14) yaxis(2) ////
|| line conbx MVZ, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1) ///
|| line upperx MVZ, clpattern(dash) clwidth(thin) clcolor(black) ///
|| line lowerx MVZ, clpattern(dash) clwidth(thin) clcolor(black) ///
|| line yline MVZ, clwidth(thin) clcolor(black) clpattern(solid) ///
|| , ///
xlabel(-2.5 (1) 3.5, nogrid labsize(2)) ///
ylabel(-0.01 (0.01) 0.04, axis(1) nogrid labsize(2)) ///
ylabel(, axis(2) nogrid labsize(2)) ///
yscale(noline alt) ///
yscale(noline alt axis(2)) ///
xscale(noline) ///
legend(off) ///
xtitle("Executive strenght" , size(2.5) ) ///
ytitle("Marginal Effect of Lagged Deaths" , axis(1) size(2.5)) ///
ytitle("Percentage of Observations" , axis(2) size(2.5)) ///
xsca(titlegap(2)) ///
ysca(titlegap(2)) ///
scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) note("Model: only with delta>=0") saving(b.gph, replace)
 
reghdfe stringencyindex c.l.windexinrow##c.coalition_seat_share_z l.stringencyindex  l.new_cases_per_million2 ///
 c.l.new_deaths_per_million2##c.coalition_seat_share_z if l.deltawindexinrow<0  & MV>6,     abs(countryname_code month_code) vce(r)

matrix b=e(b)
matrix V=e(V)
matlist b
matlist V
scalar b1=b[1,1]
scalar b3=b[1,3]
scalar list b1 b3
scalar varb1=V[1,1]
scalar varb3=V[3,3]
scalar covb1b3=V[1,3]
scalar list b1 b3 varb1 varb3 covb1b3

drop conbx consx ax upperx lowerx 

gen conbx=b1+b3*MVZ if MVZ!=.
gen consx=sqrt(varb1+varb3*(MVZ^2)+2*covb1b3*MVZ) if MVZ!=.
gen ax=1.96*consx
gen upperx=conbx+ax
gen lowerx=conbx-ax

graph twoway hist coalition_seat_share_z, width(0.1) percent color(gs14) yaxis(2) ////
|| line conbx MVZ, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1) ///
|| line upperx MVZ, clpattern(dash) clwidth(thin) clcolor(black) ///
|| line lowerx MVZ, clpattern(dash) clwidth(thin) clcolor(black) ///
|| line yline MVZ, clwidth(thin) clcolor(black) clpattern(solid) ///
|| , ///
xlabel(-2.5 (1) 3.5, nogrid labsize(2)) ///
ylabel(-0.04 (0.01) 0.04, axis(1) nogrid labsize(2)) ///
ylabel(, axis(2) nogrid labsize(2)) ///
yscale(noline alt) ///
yscale(noline alt axis(2)) ///
xscale(noline) ///
legend(off) ///
xtitle("Executive strenght" , size(2.5) ) ///
ytitle("Marginal Effect of Lagged Deaths" , axis(1) size(2.5)) ///
ytitle("Percentage of Observations" , axis(2) size(2.5)) ///
xsca(titlegap(2)) ///
ysca(titlegap(2)) ///
scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) note("Model: only with delta<0")  saving(c.gph, replace)
 
gr combine b.gph c.gph a.gph, scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white))


